//
// Created by hjie on 23-12-27.
//

#pragma once

#include <cstring>
#include <string>
#include <memory>
#include <functional>
extern "C"
{
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/frame.h>
#include <libavutil/buffer.h>
#include <libavutil/hwcontext.h>
#include <libavfilter/avfilter.h>
#include <libavutil/pixfmt.h>
#include <libavutil/pixdesc.h>
}

class DecoderContext;
class EncoderContext;

class MediaStream
{
private:
    friend class InputFormatContext;
    friend class OutputFormatContext;
public:
    MediaStream();
    int Index();
    AVStream * AvStream();
    std::shared_ptr<EncoderContext> Encoder();
    std::shared_ptr<DecoderContext> Decoder();
private:
    AVStream * m_stream;
    int        m_stream_index{-1};
private:
    std::shared_ptr<EncoderContext> m_encoder;
    std::shared_ptr<DecoderContext> m_decoder;
};

